package com.fifth.apartment.others;

import com.fifth.apartment.result.Result;
import com.fifth.apartment.service.MailService;
import com.fifth.apartment.vo.MailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author Dao
 * @since 2024/7/15
 */
@RestController
//@RequestMapping("/admin/mail")
//@Api(tags = "邮件接口")
@Slf4j
public class MailController {

    @Autowired
    private MailService service;

    @ApiOperation("文本邮件发送接口")
    @PostMapping("sendMail")
    public Result sendMail(@RequestBody MailVO vo){
        Boolean flag = service.sendMail(vo);
        return new Result(flag,"邮件发送状况");
    }

    @ApiOperation("HTML邮件发送接口")
    @PostMapping("sendHTMLMail")
    public Result sendHTMLMail(@RequestBody MailVO vo){
        Boolean flag = service.sendHTMLMail(vo);
        return new Result(flag,"邮件发送状况");
    }

    @ApiOperation("携带附件邮件发送接口")
    @PostMapping("sendAttchMail")
    public Result sendAttchMail(@RequestBody MailVO vo){
        Boolean flag = service.sendAttchMail  (vo);
        return new Result(flag,"邮件发送状况");
    }
}
